package com.lazar.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DbHelper {

    private static String DNS = "jdbc:mysql://172.16.24.150:3306/luo";
    private static String user = "root";
    private static String pass = "newton";

    private static String driver = "com.mysql.jdbc.Driver";

    private static Connection conn = null;

    public DbHelper(){}


    public static Connection getConn(){
        if (null == conn){
            try {
                Class.forName(driver);
                conn = DriverManager.getConnection(DNS,user,pass);
            } catch (ClassNotFoundException | SQLException e) {
                e.printStackTrace();
            }
        }

        return conn;
    }

    public static void main(String[] args) {
        System.out.println(getConn());
    }
}
